def draw_validate(f):
    def helper(hobj, **kwargs):
        if hobj._bins is None:
            msg = "Attempt to draw empty histogram `{0}'"
            raise ValueError(msg.format(hobj.name))

        hobj.flush()

        if hobj._tot_i == 0:
            msg = "Attempt to draw empty histogram `{0}'"
            raise ValueError(msg.format(hobj.name))


        return f(hobj, **kwargs)

    return helper


